<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
	    <base href="<%=basePath%>"></base>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title></title>
		<!-- Libraries -->
		<link type="text/css" href="<%=path %>/manage/css/layout.css" rel="stylesheet" />
		<link type="text/css" href="<%=path%>/manage/css/new_style.css" rel="stylesheet" />
		<script type="text/javascript" src="<%=path %>/manage/js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/easyTooltip.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/jquery.wysiwyg.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/hoverIntent.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/superfish.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/custom.js"></script>
		<script type="text/javascript" src="<%=path %>/manage/js/My97DatePicker/WdatePicker.js"></script>
		<sx:head />
		<script language="javascript" type="text/javascript">
		
function openOrder(intOrderId) {
	    //应用编辑
			$.ajax({
				url : root+'/order/getOrder.action',
				method : 'post',
				dataType : 'json',
				data:{'intOrderId' : intOrderId},
				success : function(data) {
				       $("#intOrderId").attr("value",data.intOrderId);
				      $("#varUserName").attr("value",data.varUserName);
				      $("#varContentName").attr("value",data.varContentName);
				      $("#datOrderDatetime").attr("value",data.datOrderDatetime);
				      $("#dobOrderMoney").attr("value",data.dobOrderMoney);
				      $("#intOrderCount").attr("value",data.intOrderCount);
				      $("#intOrderStatues").attr("value",data.intOrderStatues);
					  $("#openOrderDialog").dialog("open");
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
			
		
	}
	
	
	
$(document).ready(function() {

		//加载消息编辑dialog
		$("#openOrderDialog").dialog({
			autoOpen : false,
			width : 420,
			height :350,
			modal : true,
			title : '订单编辑',
			buttons :{
				"保存" : function() {
				    $("#openOrderform").submit();
					$(this).dialog("close");
				},
				"取消" : function() {
					$(this).dialog("close");
					$("#openOrderform")[0].reset();
				}
			},
			close : function() {
				$("#openOrderform")[0].reset();
			}
        
	});
	//验证
		
		 var parkinginfoForm = $("#openOrderform").validate({ 	       
		        rules : {
		           "orderInfo.dobOrderMoney" : {
		          	  required : true
		            },
		            "orderInfo.datOrderDatetime":{
		             required : true
		            },
		              "orderInfo.intOrderCount" : {
		                required : true		              
		            }		           
		        },
		        messages : {
		              "orderInfo.dobOrderMoney" : {
		          	  required : "请输入订单金额"
		            },
		             "orderInfo.datOrderDatetime" : {
		                required : "请输入下单时间"
		            },
		              "orderInfo.intOrderCount" : {
		                required : "请输入商品数量"
		               
		            }		           
		        }
	
	
	
	});
	});
	//删除订单
	function delOrder(intOrderId) {
	if (confirm("慎重考虑是否确定删除该记录?删除后无法查看该条记录！！！")) {	  	  
			$.ajax({
				url : root+'/order/delOrder.action',
				method : 'post',				
				data:{'intOrderId' : intOrderId},
				success : function(data) {
				  alert("删除成功");
				  window.location.href=root+'/order/getOrderPage.action';
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
			}
}
	
	
</script>

	</head>

	<body>
		
					<div >
				<p class="sitemap">当前位置：内容管理 > 订单管理</p>
                <h1>订单管理</h1>
					<div>
					
						<!-- Tabs -->
						<div id="tabs">
							<ul>
								<li><a href="#tabs-1">订单内容列表</a></li>
								
							</ul>
							<!-- 检索 -->
	  <div>
	<form name="searchForm" id="searchForm" method="post" action="<%=path %>/order/getOrderPage.action" style="margin:10px 0;">
	 用户名:<s:textfield name="condition.varUserName"></s:textfield> 
	 下单时间 <s:textfield name="condition.datOrderDateStartTime" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,maxDate:'#F{$dp.$D(condition_datOrderDateEndTime)}'})"/>~
		 <s:textfield name="condition.datOrderDateEndTime" onClick="WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,minDate:'#F{$dp.$D(condition_datOrderDateStartTime)}'})"/>
		<input type="submit" id="searchBtn" value="检索" >    							
		         							</form> 
		         							
		</div>
	  	<!-- 检索 END-->
							<!-- First tab -->
					              <table cellspacing="0" cellpadding="0" border="0" class="fullwidth">
                                              <thead>
                                                <tr>
                                                  <td>订单编号</td>
                                                  <td width="150px;">用户名</td>
                                                  <td>电话号码</td>
                                                  <td>内容标题</td>
                                                   <td>金额</td>
                                                  <td>下单时间</td>
                                                  <td>下单状态</td>
                                                  <td>操作</td>
                                                </tr>
                                              </thead>
                                              <tbody>
                                              <s:iterator value="orderList">
                                                <tr class="odd">
                                                 <td><s:property value="intOrderId"/></td>
                                                  <td><s:property value="varUserName"/></td>
                                                   <td><s:property value="varUserPhoneNum"/></td>
                                                   <td><s:property value="varContentName"/></td>
                                                   <td><s:property value="dobOrderMoney"/></td>                                                 
                                                  <td><s:property value="datOrderDatetime"/></td>
                                                  <td><s:property value="intOrderStatues"/></td>
                                                  <td>
                                                 
                                                 
												 <a class="icon icon_edit" title="编辑 "  href="javascript:openOrder('<s:property value="intOrderId" />')"></a>
												 <a class="icon icon_delete" title="删除 "  href="javascript:delOrder('<s:property value="intOrderId" />')"></a>
								</td>
                                                </tr>
                                               </s:iterator> 
                                               
                                              </tbody>
                                          </table>
							<!-- End of Tabs -->
						</div>
							<!-- 分页标签开始 -->
                <div align="right" style="float:right;">
                <d:page id="page" template="details" skin="gray">
                </d:page>
                </div>
                <!-- 分页标签结束 -->
						<hr />
					</div>
				</div>
				
			
		<!-- 编辑页使用的弹出层 -->
		<div id="openOrderDialog" style="display: none;">
		
		<form id="openOrderform" action="<%=path %>/order/editOrder.action" method="post" >
							<table class="fullwidth" cellpadding="0" cellspacing="0"
								border="0">
								<tr>
									<td>
										订单编号
									</td>
									<td>									   
										<input type="text" name="orderInfo.intOrderId" id="intOrderId" readonly="readonly">
									</td>
								</tr>
								<tr>
									<td>
										用户名
									</td>
									<td>									   
										<input type="text" name="orderInfo.varUserName" id="varUserName" readonly="readonly">
									</td>
								</tr>
								
								<tr>
									<td>
										内容标题
									</td>
									<td>									   
										<input type="text" name="orderInfo.varContentName" id="varContentName" readonly="readonly">
									</td>
								</tr>
								<tr>
									<td>
										金额
									</td>
									<td>									   
										<input type="text" name="orderInfo.dobOrderMoney" id="dobOrderMoney" >
									</td>
								</tr>
								<tr>
									<td>
										下单时间
									</td>
									<td>									   
										<input type="text" name="orderInfo.datOrderDatetime" id="datOrderDatetime" readonly="readonly">
									</td>
								</tr>
								<tr>
									<td>
										订单状态
									</td>
									<td>									   
										<input type="text" name="orderInfo.intOrderStatues" id="intOrderStatues" >
									</td>
								</tr>
								
								<tr>
									<td>
										商品数量
									</td>
									<td>									   
										<input type="text" name="orderInfo.intOrderCount" id="intOrderCount" >
									</td>
								</tr>
									
							</table>
                       </form>
					</div>
	
	</body>
</html>
